
# $Id: Makefile 42 2007-07-25 06:45:00Z kf701.ye $

SRC=$(wildcard *.c)
#OBJS=${SRC:%.c=%.o}
NAME=${SRC:%.c=%}
DEPS=$(SRC:%.c=.dep/%.d)

TARGET_MAJOR=libsoftwarefactory.so.1
TARGET_MINOR=libsoftwarefactory.so.1.0
TARGET_SO=libsoftwarefactory.so
TARGET_A=libsoftwarefactory.a

LIB_INC_DIR=-I../include
CFLAGS=-Wall -Os -Wstrict-prototypes -fPIC $(LIB_INC_DIR) $(DLIB)
LDFLAGS=-shared

.PHONY: dep  all


all :  $(OBJS)
	make dll_lib
	make static_lib
	

dll_lib: $(OBJS)
	$(CC) ${LDFLAGS} -Wl,-soname,${TARGET_MAJOR} -o ${TARGET_MINOR} ${OBJS} 
	$(STRIP) ${TARGET_MINOR}
	$(LN) -s ${TARGET_MINOR} ${TARGET_MAJOR}
	$(LN) -s ${TARGET_MAJOR} ${TARGET_SO}

static_lib: $(OBJS)
	$(AR) rcs ${TARGET_A} ${OBJS}
	$(CHMOD) +x ${TARGET_A}



%.o: %.c
	${CC} ${CFLAGS} -c $<
	@mkdir -p .dep
	${CC} -MM $(CFLAGS) $*.c > .dep/$*.d 

clean:
	@rm -fr *.o core .dep


dep: 
	@mkdir -p .dep
	for i in ${NAME} ; do  \
		${CC} -MM $(CFLAGS) "$${i}".c > .dep/"$${i}".d ;\
	done

